#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "fun.h"
#include "manage.h"
#include "ranking.h"


int main() {
	char MI_MA[15];
	int choice = 8;

    int z = 3;  

    readFile(a, b, c, &n, &zong);

    while (1) {
        system("cls");
        switch (choice) {
            case 1:
                menu1(a, b, c, &n,&zong);  
                choice = 7;
                break;

            case 2:
            	if(n == 0){
            		printf("请先输入玩家信息！");
				}
				else{
					menu2(a, b, c, &n); 
				}
                 
                choice = 7;
                break;

            case 0:
                printf("退出系统!\n");
                writeFile(a, b, c, n, zong); 
                exit(0);
                break;

            case 7:
                menu();
                if(scanf("%d", &choice) == 0){
                	system("cls");
					printf("请重新选择\n");
                	
				}
                
                getchar();
                break;
            
 			case 8:
 				printf("请输入密码：");
 				scanf("%s",MI_MA);
 				if(strcmp(MI_MA,"mwyx123")==0){
 					printf("欢迎来到管理系统！");
					choice = 7;
 					
				 }
				 else{
				 	z--;
				 	printf("密码错误,您还有%d次机会",z);
				 	if(z == 0){
				 		printf("验证失败！");
						 printf("\a\a\a");
						 choice = 0;
					 }
				 	
				 }break;

            default:
                printf("选择无效，请重新选择。\n");
                system("pause");
                choice = 7;
        }
    }
    return 0;
}


  
  
  
  
  
  
  